export const getWebSocketUrl = () => {
  let webUrl = window.location.origin + window.location.pathname
  let hostname = window.location.hostname
  let protocol = location.protocol === 'https:' ? 'wss://' : 'ws://'
  console.log('protocol: ' + protocol)
  let wsPreUrl = protocol + hostname
  // 无nginx
  let wsSufUrl1 = ':8080/websocket/'
  // 存在nginx
  let wsSufUrl2 = '/websocket/websocket/'
  let realWsSufUrl = (webUrl.indexOf('localhost') !== -1 || webUrl.indexOf('127.0.0.1') !== -1) ? wsSufUrl1 : wsSufUrl2
  let websocketUrl = wsPreUrl + realWsSufUrl
  console.log('websocketUrl: ' + websocketUrl)
  return websocketUrl
}
